package bagu.stream;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

public class StreamDemo01 {
    public static void main(String[] args) {
        List<Integer> numbers = Arrays.asList(1, 2, 3, 4, 5, 6);
        List<Integer> evenNumbers = numbers.stream()
                .filter(n -> n % 2 == 0).collect(Collectors.toList());
        for (Integer num : evenNumbers)
            System.out.println(num);

        List<String> words = Arrays.asList("apple", "bananna", "ask");
        List<String> upperWords = words.stream().map(String::toUpperCase).collect(Collectors.toList());
        upperWords.forEach(word->{
            System.out.println(word);
        });

        // test

    }
}
